package com.longrise.android.byjk.plugins.aboutme.personalInfo.product_show;

import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.longrise.LEAP.Base.Objects.EntityBean;
import com.longrise.android.byjk.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/3/9.
 * 产品方案的adapter
 */

public class ProductProAdapter extends BaseQuickAdapter<ProductProBean, BaseViewHolder> {

    private List<EntityBean> mListBeans = new ArrayList<>();
    private OnItemClickListener mListener;
    private boolean isEdit;
    private ArrayList<ProductProBean> mSelectedBeans = new ArrayList<>();

    public ProductProAdapter() {
        super(R.layout.item_rcv_person_honor);
    }

    public void setDatas(List<ProductProBean> childBeanList) {
        setNewData(childBeanList);
    }

    public void editData(boolean b) {
        this.isEdit = b;
        notifyDataSetChanged();
    }


    @Override
    protected void convert(BaseViewHolder helper, final ProductProBean productBean) {
        View convertView = helper.getConvertView();
        RelativeLayout mRlgrry = (RelativeLayout) convertView.findViewById(R.id.item_person_honor_rl);
        TextView mTvgrry = (TextView) convertView.findViewById(R.id.item_person_honor_tv);
        mTvgrry.setText(productBean.getProductName());

        convertView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mListener.onItemClick(productBean);
            }
        });
    }

    public void setOnItemClickListener(OnItemClickListener listener) {
        this.mListener = listener;
    }

    public interface OnItemClickListener {

        void onItemClick(ProductProBean honorBean);
    }
}

